package com.qf.controller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qf.entity.LaoWuUser;
import com.qf.service.LaoWuUserService;
import com.qf.until.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;

/**
 * --- 木叶飞舞之处，火之意志生生不息---
 *
 * @author
 * @date 2024/7/25
 * @desc
 */
@RestController
@RequestMapping("/wms/laoWu")
public class LaoWuUserController {
    @Autowired
    private LaoWuUserService laoWuUserService;



    //查询劳务管理全部信息
    @GetMapping("/lwfindAll")
    public R lwfindAll(@RequestParam HashMap<String, String> map) {
        int pageNum = Integer.parseInt(map.get("pageNum"));
        int pageSize = Integer.parseInt(map.get("pageSize"));
        PageHelper.startPage(pageNum, pageSize);
        List<LaoWuUser> list = laoWuUserService.lwfindAll(map);
        PageInfo<LaoWuUser> info = new PageInfo<>(list);
        return R.ok(info);
    }

    /**
     * 批量删除劳务管理的信息
     */
    @GetMapping("/delBatch")
    public R delBatch(@RequestParam List<Integer> ids) {
        System.out.println("批量删除从前端传回来的数据" + ids);
        boolean isok = laoWuUserService.delBatch(ids);
        return R.ok(isok);
    }

    /**
     * 添加
     */
    @PostMapping("/add")
    public R addLaoWuUser(@RequestBody  LaoWuUser laoWuUser) {
        boolean isok  = laoWuUserService.addLaoWuUser(laoWuUser);
        return R.ok(isok);
    }
}
